package com.globallogic.model.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;

import com.globallogic.model.transferobject.UserTo;

@Entity
@Table(name = "User")
public class User implements EntityInterface<UserTo> {

	public void setName(String value) {
		this.name = value;
	}

	public String getName() {
		return this.name;
	}

	public void setPassword(String value) {
		this.password = value;

	}

	public String getPassword() {
		return this.password;
	}

	public void setFullName(String value) {
		this.fullName = value;
	}

	public String getFullName() {
		return this.fullName;
	}

	public void setEmail(String value) {
		this.email = value;
	}

	public String getEmail() {
		return this.email;
	}

	public void setNotes(String value) {
		this.notes = value;
	}

	public String getNotes() {
		return this.notes;
	}

	public void setIsAdmin(boolean value) {
		this.isAdmin = value;
	}

	public boolean getIsAdmin() {
		return this.isAdmin;
	}
	
	public int getId(){
		return this.id;
	}

	public void setId(int id){
		this.id = id;
	}
	
	public UserTo getTo(){
		UserTo transferObject = new UserTo();
		
		transferObject.setName(name);
	    transferObject.setFullName(fullName);
		transferObject.setEmail(email);
		transferObject.setIsAdmin(isAdmin);
		transferObject.setNotes(notes);
		transferObject.setPassword(password);
		transferObject.setId(id);
		
		return transferObject;
	} 
	
	@Column(name = "name")
	private String name;

	@Column(name = "password")
	private String password;

	@Column(name = "fullName")
	private String fullName;

	@Column(name = "email")
	private String email;

	@Column(name = "notes")
	private String notes;

	@Column(name = "isAdmin")
	private boolean isAdmin;

	@Id
	@GeneratedValue
	private int id;

	@Override
	public Object getPrimaryKey() {
		return id;
	}
	
	@Override
	public String toString() {
		return "name: " + name +
			   "  fullName: " + fullName +
			   "  email: " + email + 
			   "  notes: " + notes +
			   "  isAdmin: " + isAdmin;
	}
}
